﻿using blackhouse.BlackApart.Business.Apartments;
using blackhouse.BlackApart.WebNemo;

namespace blackhouse.StareKino.Web.ApartmentType {
    public class AdditionalInformationApartmentType {

        #region Properties

        public int Floor {
            get;
            private set;
        }

        public string ApartmentGroupName {
            get;
            private set;
        }

        #endregion

        #region Constructors

        public AdditionalInformationApartmentType(IApartmentGroup group) {
            if (group == null) return;
            var apartmentType = @group as NemoApartmentType ?? new NemoApartmentType(@group.Id);
            if (!apartmentType.Exists()) return;
         
            this.Floor = apartmentType.IsNotNull("pietro") ? apartmentType.GetInt32("pietro") : 0;

            var sharedType = apartmentType.GetRecord("wspoldzielony_typ");
            if (sharedType != null && sharedType.Exists) {
                this.ApartmentGroupName = sharedType.GetString("nazwa");
            }
        }

        #endregion

    }
}